//
// Created by bill3000 on 2/10/21.
//

#ifndef INTELLI_QUEUE_HPP
#define INTELLI_QUEUE_HPP

#include "../fsm/event.hpp"

typedef struct Message {
    long mtype;  //100：从Web服务分析控制;200：从分析控制Web服务
    Event data;
} Message;

enum QueueMacros {
    M01, //Message Queue 01, for UI and Analyzer
    M02, //Message Queue 02, main queue for FSM
    M03, //Message Queue 03, for Mechanical Control thread
    M04  //Message Queue 04, for size analysis and sugar analysis thread
};

class Queue {
public:
    static Queue* get_instance();
    static void dispose();
    int send_message(int queue, Message *message) const;
    int receive_message(int queue, Message *message, long mtype) const;
    virtual ~Queue();

private:
    Queue();
    static Queue* instance;
    int id_01, id_02, id_03, id_04;
};

#endif //INTELLI_QUEUE_HPP
